﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OpenComposite.EII.RepositoryUIs
{
	public partial class FormEditHumanActivityHostname : Form
	{
		public FormEditHumanActivityHostname()
		{
			InitializeComponent();
			this.DialogResult = DialogResult.None;
		}

		public string HostName
		{
			get
			{
				if ( txtName.Text.Contains(":") ) {
					return txtName.Text.Substring(0, txtName.Text.IndexOf(':'));
				} else {
					return txtName.Text;
				}
			}
			set { txtName.Text = value; }
		}

		private void tsbtnSaveClose_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.OK;
		}

		private void tsbtnCancel_Click(object sender, EventArgs e)
		{
			this.DialogResult = DialogResult.Cancel;
		}

		private void txtName_KeyUp(object sender, KeyEventArgs e)
		{
			if ( e.KeyCode == Keys.Enter ) {
				tsbtnSaveClose_Click(sender, EventArgs.Empty);
			}
		}
	}
}
